<template>
  <div>
    <el-form :model="form" label-width="120px">
    <el-form-item label="题目">
      <el-input v-model="question.text" />
    </el-form-item>
    <el-form-item label="题目类型">
      <el-select v-model="question.type" placeholder="请选择题目类型">
        <el-option
        v-for="item in questionTypes"
        :key="item.id"
        :label="item.label"
        :value="item"
      />
      </el-select>
      <el-form-item label="题目难度">
        <el-select v-model="question.difficulty"  placeholder="请选择题目难度">
        <el-option
        v-for="item in difficulty"
        :key="item.id"
        :label="item"
        :value="item"
      />
      </el-select>
    </el-form-item>
    <el-form-item label="分类">
      <el-input v-model="amount" />
    </el-form-item>
      <el-form-item v-if="question.type=='单选题'||question.type=='多选题'&&question.type==null" label="输入选项个数">
        <el-input-number v-model="amount" :min="1" :max="6"  />
    </el-form-item>
    </el-form-item>
    <el-form-item v-if="question.type=='单选题'||question.type=='多选题'&&question.type==null"  label="输入选项内容">
      <el-form-item  v-for="(o,index) in opt" :key="index" >
        {{o}} <el-input />
      </el-form-item>
    </el-form-item>
    <el-form-item  v-if="question.type=='简答题'"  label="答案">
      <el-input
        v-model="question.answer"
        autosize
        type="textarea"
        placeholder="Please input"
  />
    </el-form-item>1
  </el-form>
  </div>
</template>

<script>
export default {
  // 组件名称
  name: 'AddQuestionView',
  // 组件参数 接收来自父组件的数据
  props: {},
  // 局部注册的组件
  components: {},
  // 组件状态值
  data () {
    return {
      question:{
        text:'',
        type:'',
        difficulty:'',
        answer:'',

      }
      ,
      amount:'',
      questionTypes:['单选题','多选题','判断题','简答题',],
      difficulty:[
        {
          label: '简单',
        },
        {
          label: '中等',
        },
        {
          label: '困难',
        },
      ],
      opt:[
        'A','B','c'
      ]
    }
  },
  // 计算属性
  computed: {},
  // 侦听器
  watch: {},
  // 组件方法
  methods: {}
}
</script>

<style scoped>

</style>
